import { ProTableColumn } from '@/components/pro-table/type'
import { NButton, NPopconfirm } from 'naive-ui'
import { AssetsModel } from '@/api/model/assets-model'

export const useAssetsProTable = () => {
  const { typeOptions } = useGetTypeList()
  const { warehouseOptions } = useGetWarehouseList()
  const columns = computed<ProTableColumn<AssetsModel>[]>(() => {
    return [
      {
        title: '资产编码',
        key: 'assetCode',
        query: {
          type: 'input'
        }
      },
      {
        type: 'dict',
        title: '资产类型',
        key: 'typeId',
        dictOptions: typeOptions.value,
        query: {
          type: 'select',
          dictOptions: typeOptions.value
        }
      },
      {
        title: '所属部门',
        key: 'branchName',
        query: {
          type: 'input'
        }
      },
      {
        title: '使用人',
        key: 'user',
        query: {
          type: 'input'
        }
      },
      {
        title: '资产名称',
        key: 'assetName',
        query: {
          type: 'input'
        }
      },
      {
        title: '品牌',
        key: 'brand'
      },
      {
        title: '单价',
        key: 'price'
      },
      {
        title: '单位',
        key: 'unit'
      },
      {
        title: '规格型号',
        key: 'model'
      },
      {
        title: '功能描述',
        key: 'function'
      },
      {
        type: 'dict',
        title: '存储位置',
        key: 'warehouseId',
        dictOptions: warehouseOptions.value,
        query: {
          type: 'select',
          dictOptions: warehouseOptions.value
        }
      },
      // {
      //   title: '备注',
      //   key: 'remark'
      // },
      {
        type: 'dict',
        title: '资产状态',
        key: 'assetStatus',
        dictOptions: useDictData('ASSETS_STATUS').value,
        query: {
          type: 'select',
          dictOptions: useDictData('ASSETS_STATUS').value
        }
      }
    ]
  })
  return {
    columns
  }
}
